public final class cc
{

    private Object b[];
    private int c;
    private int d;
    public int a;

    public cc()
    {
        this(10);
    }

    public cc(int i)
    {
        b = null;
        c = 0;
        d = 0;
        a = 0;
        b = new Object[i];
    }

    public final String toString()
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append('[');
        for(int i = 0; i < a; i++)
        {
            if(i > 0)
            {
                stringbuffer.append(',');
                stringbuffer.append(' ');
            }
            stringbuffer.append(a(i));
        }

        stringbuffer.append(']');
        return stringbuffer.toString();
    }

    public final boolean a()
    {
        return a == 0;
    }

    private int c(int i)
    {
        if(++i >= b.length)
            i = 0;
        return i;
    }

    private int d(int i)
    {
        if(--i < 0)
            i = b.length - 1;
        return i;
    }

    private void e(int i)
    {
        if(i < 0 || i >= a)
            throw new IndexOutOfBoundsException();
        else
            return;
    }

    public final void b()
    {
        for(; !a(); b(0));
    }

    public final Object a(int i)
    {
        e(i);
        return b[(c + i) % b.length];
    }

    public final Object a(int i, Object obj){
        try {
            e(i);
            i = (c + i) % b.length;
            Object obj1 = b[i];
            b[i] = obj;
            return obj1;
        } catch (Exception exception) {
            b[i] = obj;
        }
        return obj;
    }

    public final int a(Object obj)
    {
        int i = 0;
        for(int j = a; i < j; i++)
            if(a(i) == obj)
                return i;

        return -1;
    }

    public final int b(Object obj)
    {
        for(int i = a - 1; i >= 0; i--)
            if(a(i) == obj)
                return i;

        return -1;
    }

    public final boolean c(Object obj)
    {
        return a(obj) != -1;
    }

    public final Object d(Object obj)
    {
        int i;
        if((i = a(obj)) != -1)
            return b(i);
        else
            return null;
    }

    public final Object b(int i){
        e(i);
        Object obj = null;
        if(i == 0){
            try{
        obj = b[c];
        b[c] = null;
        c = c(c);
        a--;
        return obj;
            }catch(Exception exception){
        b[c] = null;
        c = c(c);
        a--;
            }
        }else
        if(i == a - 1){
            try{
        d = d(d);
        obj = b[d];
        b[d] = null;
        a--;
        return obj;
            }catch(Exception exception1){
        b[d] = null;
        a--;
            }
        }else{
            try{
        obj = a(i);
        for(; i < a - 1; i++)
            a(i, a(i + 1));

        a(a - 1, null);
        d = d(d);
        a--;
        return obj;
        }catch(Exception exception2){
        for(; i < a - 1; i++)
            a(i, a(i + 1));

        a(a - 1, null);
        d = d(d);
        a--;
            }

        }
        return obj;
    }

    private void f()
    {
        if(a < b.length)
            return;
        Object aobj[] = new Object[b.length * 2];
        int i = 0;
        for(int j = a; i < j; i++)
            aobj[i] = a(i);

        c = 0;
        d = a;
        b = aobj;
    }

    public final boolean e(Object obj)
    {
        f();
        b[d] = obj;
        d = c(d);
        a++;
        return true;
    }

    public final void b(int i, Object obj)
    {
        e(i);
        f();
        d = c(d);
        a++;
        for(int j = a - 1; j > i; j--)
            a(j, a(j - 1));

        a(i, obj);
    }

    public final Object c()
    {
        if(a())
            return null;
        else
            return b(a - 1);
    }

    public final Object d()
    {
        if(a())
            return null;
        else
            return a(a - 1);
    }

    public final cc e()
    {
        int i = a;
        cc cc1 = new cc(b.length);
        for(int j = 0; j < i; j++)
            cc1.e(a(j));

        return cc1;
    }
}